package com.inspur.jxpcxt.service;

import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;

import org.apache.http.client.HttpClient;
import org.apache.http.impl.client.DefaultHttpClient;

import com.inspur.jxpcxt.constants.ServerConstants;
import com.inspur.jxpcxt.utils.CommonService;
import com.inspur.jxpcxt.utils.JXPCLog;

public class NewUserService {
	/* *
	 * 将手机端的请求用HttpClient Get方式发送到服务器端
	 * @param sno
	 * @param sname
	 * @param cno
	 * @param pswd
	 * @return
	 */
	//采用HttpClient Get
	@SuppressWarnings("deprecation")
	public static String NewUserByClientGet(String sno,String sname,String cno,String pswd,String findpswd){
			
				//1.创建HttpClient对象
				HttpClient client = new DefaultHttpClient();
				//拼装路径
				String path = null;
				//2.拼装路径
				try {
				 path = "http://"+ServerConstants.SERVER_IP+":8080/Web/LoginServlet?sno="
								+URLEncoder.encode(sno)
								+"&sname="
								+URLEncoder.encode(sname,"UTF-8")
								+"&cno="
								+URLEncoder.encode(cno)
								+"&pswd="
								+URLEncoder.encode(pswd)
								+"&findpswd="
								+URLEncoder.encode(findpswd)
								+"&service="
								+URLEncoder.encode(ServerConstants.SERVER_NEW_USER_SERVICE,"UTF-8");//用于在服务器端识别是哪个请求的标志
				JXPCLog.e("zoule");
			}catch (UnsupportedEncodingException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
			return CommonService.serviceRequest(path, client);
}
}
